package com.acumenvn.pent.GameServices;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Preferences;

public class PreferencesManager {
	// constanst
	private static final String PREF_VOLUME = "Volume";
	private static final String PREF_MUSIC = "Music.Enabled";
	private static final String PREF_SOUND = "Sound.Enabled";
	private static final String PREF_NAME = "PENT";
	
	public PreferencesManager() {
		
	}
	
	protected Preferences getPref() {
		return Gdx.app.getPreferences(PREF_NAME);
	}
	
	public Boolean isSoundEnabled() {
		return getPref().getBoolean(PREF_SOUND);
	}
	
	public void setSoundEnabled(Boolean turnOn) {
		getPref().putBoolean(PREF_VOLUME, turnOn);
		getPref().flush();
	}
	
	public Boolean isMusicEnabled() {
		return getPref().getBoolean(PREF_MUSIC);
	}
	
	public void setMusicEnabled(Boolean turnOn) {
		getPref().putBoolean(PREF_MUSIC, turnOn);
		getPref().flush();
	}
	
	public float getVolume() {
		return getPref().getFloat(PREF_VOLUME, 0.5f);
	}
	
	public void setVolume(float volumeValue) {
		getPref().putFloat(PREF_SOUND, volumeValue);
		getPref().flush();
	}
	
}
